﻿#region

using System.Collections.Generic;
using System.Configuration;
using Lab.Common.Dto;
using Lab.DataContext.DataContext;
using Lab.Server.Application;

#endregion

namespace Lab.Server.WcfService.WcfService {
    public class WcfService : IWcfService {
        private readonly ApplicationService applicationService;

        private readonly string connectionString =
            ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;

        public WcfService() {
            var dataContext = new DataContextLinqToSqlDataContext(connectionString);
            var context = new Context(dataContext);
            applicationService = new ApplicationService(context);
        }

        public void AddVacancy(DtoVacancy vacancy) {
            applicationService.AddVacancy(vacancy);
        }

        public void AddEmployer(DtoEmployer employer) {
            applicationService.AddEmployer(employer);
        }

        public void AddKindOfActivity(DtoKindOfActivity dtoKindOfActivity) {
            applicationService.AddKindOfActivity(dtoKindOfActivity);
        }

        public ICollection<DtoVacancy> GetOpenVacancies() {
            return applicationService.GetOpenVacancies();
        }

        public void AddApplicant(DtoApplicant dtoApplicant) {
            applicationService.AddApplicant(dtoApplicant);
        }

        public void AddSkill(DtoSkill dtoSkill) {
            applicationService.AddSkill(dtoSkill);
        }

        public void MakeDeal(DtoDeal dtoDeal) {
            applicationService.MakeDeal(dtoDeal);
        }

        public List<DtoSkill> GetSkills() {
            return applicationService.GetSkills();
        }

        public List<DtoVacancy> GetAllVacancies() {
            return applicationService.GetAllVacancies();
        }

        public List<DtoEmployer> GetEmployers() {
            return applicationService.GetEmployers();
        }

        public List<DtoKindOfActivity> GetKindOfActivities() {
            return applicationService.GetKindOfActivities();
        }

        public List<DtoApplicant> GetApplicants() {
            return applicationService.GetApplicants();
        }

        public List<DtoDeal> GetDeals() {
            return applicationService.GetDeals();
        }
    }
}